package com.itheima.xmy.Demo.Demo06;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/*请编写程序，模拟JUnit的@Test注解*/
public class Demo06 {

    @MyTest
    public void test1(){
        System.out.println("=====test1====");
    }

    @MyTest
    public void test2(){
        System.out.println("=====test2====");
    }


    public void test3(){
        System.out.println("=====test2====");
    }

    public static void main(String[] args) throws InvocationTargetException, IllegalAccessException {
        Demo06 demo06 = new Demo06();
        Class<? extends Demo06> aClass = demo06.getClass();
        Method[] declaredMethods = aClass.getDeclaredMethods();
        for (Method declaredMethod : declaredMethods) {
            if(declaredMethod.isAnnotationPresent(MyTest.class)){
                declaredMethod.invoke(demo06);
            }
        }
    }

}
